function [SEARCH,settings] = initialize_search(settings)
% search for k (=d_sub) initialization
if strcmp(settings.k,'automatic')
    % automatic search for k
    if settings.k_step >= settings.max_dim/4, settings.k_step = floor(settings.max_dim/4); end
    if settings.max_dim < 10, settings.k_step = 1; end
    SEARCH.x = settings.k_step*[1 2 3];
    SEARCH.E = -ones(size(SEARCH.x));
    SEARCH.terminate = 0;
    SEARCH.step = settings.k_step;
    settings.k = SEARCH.x(1);
    settings.search_for_k = true;
else
    SEARCH = [];
    settings.search_for_k = false;
end
SEARCH.in_progress = true;

